<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>工作台</title>
    <link rel="stylesheet" type="text/css" href="/webapp/css/easyui.css">
    <link rel="stylesheet" type="text/css" href="/webapp/css/model.css">
    <link rel="stylesheet" type="text/css" href="/webapp/css/icon.css">
    <link rel="stylesheet" type="text/css" href="/webapp/css/color.css">
    <link rel="stylesheet" type="text/css" href="/webapp/css/public.css">

    <!--<script src="http://i.gtimg.cn/qzone/biz/gdt/lib/jquery/jquery-2.1.4.js?max_age=31536000"></script>-->
    <script type="text/javascript" src="/webapp/js/lib/jquery.min.js"></script>

    <!--<script src='https://cdn.bootcss.com/jquery.form/4.2.2/jquery.form.min.js'></script>-->
    <script type="text/javascript" src="/webapp/js/lib/jquery.easyui.min.js"></script>
    <script type="text/javascript" src="/webapp/js/lib/ajaxfileupload.js"></script>
    <script type="text/javascript" src="/webapp/js/lib/jquery.global.settings.js"></script>
    <script type="text/javascript" src="/webapp/js/common/metadata.js"></script>
    <script type="text/javascript" src="/webapp/js/common/config.js"></script>
    <script type="text/javascript" src="/webapp/js/common/workshop.js"></script>
    <!--<script type="text/javascript" src="/webapp/js/common/cities.js"></script>-->
    <script type="text/javascript" src="/webapp/js/lib/xlsx.full.min.js"></script>
    <!--<script type="text/javascript" src="/webapp/js/common/export.js"></script>-->

    <script type="text/javascript" src="/webapp/js/lib/Jquery.easyui.tooltip.js"></script>
</head>
<body >
<div id="cc" class="easyui-layout" style="width:100%;height:100%;max-height: 815px;">
    <!-- 顶部板块(查询栏) -->
    <div data-options="region:'north'" style="height:18%">
        <!--<div class="easyui-panel" style="width:100%;height:190px;overflow-x: auto;border:none;">-->
        <div id="nav" class="nav"></div>
        <div class="easyui-panel" style="width:100%;border:none;">
            <form id="ff">
                <input id="totalStatus" name="totalStatus" style="display: none" value="true"/>  <!-- 用来标记是否查询总数 -->

                <div style="margin-bottom:5px;">
                    </select><label class="item-label">年份：</label>
                    <select class="easyui-combobox year" id="year"  name="year" data-options="panelHeight:'150'" style="width:6%;">
                    </select>
                    <label class="item-label" id="label-for-mall" >商场码：</label>
                    <!--为声明-->
                    <select id="mallcomparer" name="mallcomparer" class="easyui-combobox" data-options="panelHeight:'auto'" style="width:3%;" prompt="比较符">
                        <option value="EQUAL"  selected = "selected" >=</option>
                        <option value="NOT_EQUAL"><pre><></pre></option>
                    </select>
                    <input type="text" id="mallSelect" name="mallCode" class="easyui-textbox" data-options="panelHeight:'150'" style="width:5%;"/>

                    <label class="item-label">品牌码：</label>
                    <input type="text" name="brandCode" class="easyui-textbox" style="width:5%;"/>

                    <label class="item-label">原始品牌：</label>
                    <input type="text" name="originalBrand" class="easyui-textbox" style="width:8%;" />
                    <label class="item-label">品类标记：</label>
                    <select  name="recordMark" class="easyui-combobox"  data-options="panelHeight:'150',prompt:'--请选择--'" style="width:12%">
                        <option value=""></option>
<!--                        <option value="auto">auto(模糊)</option>-->
<!--                        <option value="exact">exact(精确)</option>-->
                        <option value="alias">alias(别名)</option>
<!--                        <option value="img">img(图片)</option>-->
<!--                        <option value="img1">img1(图片)</option>-->
<!--                        <option value="img2">img2(图片)</option>-->
                        <option value="sku套">sku套</option>
                        <option value="sku1">sku1</option>
                        <option value="sku2">sku2</option>
<!--                        <option value="sku3">sku3</option>-->
<!--                        <option value="sku4">sku4</option>-->
                        <option value="系">系</option>
<!--                        <option value="系H">系H</option>-->
                        <option value="@">@</option>
                        <option value="机">机</option>
                        <option value="套">套</option>
                        <option value="copy">copy</option>
                        <option value="复">复</option>
                        <option value="转">转</option>
                        <option value="合">合</option>
                        <option value="周">周</option>
<!--                        <option value="供">供</option>-->
<!--                        <option value="wholesale">批发数据</option>-->
                        <option value="销量还原">销量还原</option>
                        <option value="销量转移">销量转移</option>
                        <option value="价格处理">价格处理</option>
                        <option value="价格还原">价格还原</option>
                        <option value="均价处理">均价处理</option>
<!--                        <option value="电商调价">电商调价</option>-->
<!--                        <option value="天猫调价">天猫调价</option>-->
                        <option value="线上调价1">线上调价1</option>
                        <option value="线上调价2">线上调价2</option>
                        <option value="线上调价5">线上调价5</option>
<!--                        <option value="线上调价3">线上调价3</option>-->
<!--                        <option value="线上调价4">线上调价4</option>-->
                        <option value="线下调价1">线下调价1</option>
                        <option value="线下调价2">线下调价2</option>
<!--                        <option value="线下调价3">线下调价3</option>-->
<!--                        <option value="渠道调价">渠道调价</option>-->
<!--                        <option value="未参考">未参考</option>-->
                        <option value="异常价处理">异常价处理</option>
                        <option value="一键调量">一键调量</option>
<!--                        <option value="EXIST">EXIST</option>-->
                        <option value="Top1">Top1</option>
                        <option value="Top4">Top4</option>
                        <option value="Top套4">Top套4</option>
<!--                        <option value="补充">补充</option>-->
<!--                        <option value="苏宁启用">苏宁启用</option>-->
                        <option value="重新识别">重新识别</option>
                        <option value="月周调整">月周调整</option>
                        <option value="空型号禁用">空型号禁用</option>
                        <option value="量价禁用">量价禁用</option>
                        <option value="一键处理">一键处理</option>
                        <option value="空型号处理">空型号处理</option>
                        <option value="空型号处理1">空型号处理1</option>
                        <option value="空型号处理2">空型号处理2</option>
                        <option value="空型号处理3">空型号处理3</option>
                        <option value="首次库">首次库</option>
                        <option value="转移库">转移库</option>
                        <option value="一键禁用">一键禁用</option>
                    </select>
                    <label class="item-label">筛选条件：</label>
                    <select id="columnbox" name="column" class="easyui-combobox" data-options="panelHeight:'auto'" style="width:5%;">
                        <option value="">-请选择-</option>
                        <option value="PRICE">价格</option>
                        <option value="COUNT">销量</option>
                        <option value="WHOLE_COUNT">批发量</option>
                        <option value="WHOLE_PEICE">批发价</option>
                        <option value="ORIGINAL_PRICE">原价</option>
                        <option value="AVG_PRICE">均价</option>
                        <option value="DISCOUNT_1">现价/均价</option>
                        <option value="DISCOUNT2_1">原价/现价</option>
                        <option value="DISCOUNT3_1">原价/均价</option>
                    </select>
                    <select id="comparerbox" name="comparer" class="easyui-combobox" data-options="panelHeight:'auto'" style="width:5%;" prompt="比较符">
                        <option value=""></option>
                        <option value="EQUAL">=</option>
                        <option value="GREAT_EQUAL">&gt;=</option>
                        <option value="GREAT">&gt;</option>
                        <option value="LITTLE">&lt;</option>
                        <option value="LITTLE_EQUAL">&lt;=</option>
                        <option value="NOT_EQUAL"><pre><></pre></option>
                    </select>
                    <input type="text" id="valuebox" name="value" class="easyui-textbox" prompt="数值" data-options="" style="width:4.8%"/>

                    <label class="item-label">状态：</label>
                    <input id="entityStatus" class="easyui-switchbutton" checked style="width:4%;height:30px;" onText="启用" offText="禁用"  >

                </div>
                <div style="margin-bottom:5px;" id="parent">
                    <label id="label-for-month" class="item-label-wrap" style="margin-right: 0px;margin-left: 0.2%">月：<input type="text" class="easyui-combobox displayWM" id="month" name="month" style="width:53%; "/></label>
                    <label id="label-for-week" class="item-label-wrap" style="margin-right: 0px;margin-left: 0.2%">周：<input type="text" class="easyui-combobox displayWM" id="week" name="week" style="width:53%; "/></label>
                    <label class="item-label" >渠道码：</label>
                    <select id="channelcomparer" name="channelcomparer" class="easyui-combobox" data-options="panelHeight:'auto'" style="width:3%;" prompt="比较符">
                        <option value="EQUAL"  selected = "selected" >=</option>
                        <option value="NOT_EQUAL"><pre><></pre></option>
                        <option value="QZ"><pre>系列</pre></option>
                    </select>
                    <input type="text" id="channelSelect" name="channelCode" class="easyui-textbox" style="width:5%;"/>
                    <label class="item-label">型号码：</label>
                    <input type="text" name="modelCode" class="easyui-textbox" style="width:5%;"/>

                    <label class="item-label">原始型号：</label>
                    <input type="text" id="originalModel" name="originalModel" class="easyui-textbox" style="width:8%;"/>
                    <label class="item-label">异常类型：</label>
                    <select class="easyui-combobox fl" id="unusualcombobx" name="queryType" data-options="panelHeight:'150',prompt:'--请选择异常类型--'" style="width:12%;">
                        <option value=""></option>
                        <option value="Q1">1.0 空型号</option>
                        <option value="Q1_1">1.1 手工标记空型号</option>
                        <option value="Q2">1.2 空型号非套餐</option>
                        <option value="Q3">1.3 销量不等于0</option>
                        <option value="Q4">1.4 销量异常</option>
                        <option value="Q5">1.5 销价异常</option>
                        <option value="Q12">1.6 非空型号</option>
                        <option value="Q17">1.7 全品类空型号</option>
                        <option value="Q22">1.8 有品牌空型号</option>
                        <option value="Q6">2.0 商场缺失</option>
                        <option value="Q7">2.1 单价或批发价或销量或批发量小于0</option>
                        <option value="Q8">2.2 销量和批发量都等于0</option>
                        <option value="Q9">2.3 单价和批发价都等于0</option>
                        <option value="Q10">2.4 销量大于0,单价等于0</option>
                        <option value="Q11">2.5 批发量大于0,批发价等于0</option>
                        <option value="Q13">3.0 空型号(已处理)</option>
                        <option value="Q14">3.1 非套餐数据</option>
                        <option value="Q15">3.2 套餐数据(未处理)</option>
                        <option value="Q15_1">3.3 套餐数据(已处理)</option>
                        <option value="Q15_2">3.4 套餐数据（空型号）</option>
                        <option value="Q16">3.5 品牌为空</option>
                        <option value="Q21">3.6 未识别品牌</option>
                        <option value="Q18">3.7 已禁用型号</option>
                        <option value="Q19">4.0 刷单数据</option>
                        <option value="Q20">4.1 型号别名</option>
                        <option value="Q23">4.2 特殊禁用</option>
                        <option value="Q24">4.3 特殊销量</option>
                        <option value="Q25">4.4 数据标记</option>
                        <option value="Q26">4.5 数据标记(空型号)</option>
                    </select>
                    <label class="item-label">筛选条件：</label>
                    <select id="columnbox2" name="column" class="easyui-combobox" data-options="panelHeight:'auto'" style="width:5%;">
                        <option value="">-请选择-</option>
                        <option value="PRICE">价格</option>
                        <option value="COUNT">销量</option>
                        <option value="WHOLE_COUNT">批发量</option>
                        <option value="WHOLE_PEICE">批发价</option>
                        <option value="ORIGINAL_PRICE">原价</option>
                        <option value="AVG_PRICE">均价</option>
                        <option value="DISCOUNT_2">现价/均价</option>
                        <option value="DISCOUNT2_2">原价/现价</option>
                        <option value="DISCOUNT3_2">原价/均价</option>
                        <option value="OPERATE_USER">操作人</option>
                    </select>
                    <select id="comparerbox2" name="comparer" class="easyui-combobox" data-options="panelHeight:'auto'" style="width:5%;" prompt="比较符">
                        <option value=""></option>
                        <option value="EQUAL">=</option>
                        <option value="GREAT_EQUAL">&gt;=</option>
                        <option value="GREAT">&gt;</option>
                        <option value="LITTLE">&lt;</option>
                        <option value="LITTLE_EQUAL">&lt;=</option>
                        <option value="NOT_EQUAL"><pre><></pre></option>
                    </select>
                    <input type="text" id="valuebox2" name="value" class="easyui-textbox" prompt="数值" data-options="" style="width:4.8%;"/>

                    <label class="item-label">量额：</label>
                    <input id="dataTotal" class="easyui-switchbutton" style="width:4%;height:30px;" >

                </div>
            </form>
            <form id="filterff">
                <div style="margin-bottom:5px;" >
                    <label class="item-label">品类：</label>
                    <input type="text" id="categorySelect" name="categoryCode" class="easyui-combobox" data-options="panelHeight:'150'" style="width:6%"/>

                    <label class="item-label">套餐码：</label>
                    <select id="combocomparer" name="combocomparer" class="easyui-combobox" data-options="panelHeight:'auto'" style="width:3%;" prompt="比较符">
                        <option value="EQUAL"  selected = "selected" >=</option>
                        <option value="NOT_EQUAL"><pre><></pre></option>
                    </select>
                    <input type="text" name="comboCode" id= 'comboCode' class="easyui-textbox" style="width:5%;"/>
                    <!--<label class="item-label" style=""></label>-->
                    <!--<a class="easyui-linkbutton c8" href="javascript:void(0);" onclick="Identify()" style="width:5%; margin-left:29.5%">识别</a>-->
                    <!--<a class="easyui-linkbutton c8" href="javascript:void(0);" onclick="searchBy()" style="width:5%;">查询</a>-->
                    <a class="easyui-linkbutton c8" href="javascript:void(0);" onclick="searchBy()" style="width:5%; margin-left:36.7%">查询</a>
                    <label class="item-label" >规格条件：</label>
                    <div id="categorywrapper" style="display:inline-block;"></div>
                </div>
            </form>
        </div>
    </div>

    <!-- 左侧板块(品牌/型号查询) -->
    <div data-options="region:'west',title:'品牌/型号查询',split:true" style="width:12%;padding:0px;height: 80%;background:#eee ">
        <!--<div class="easyui-panel" id="lll"style="float:left;flex:none;min-height: 609px;padding-left:2px;">-->
        <label>品牌：</label>
        <div>
            <input type="text" id="brandName" class="easyui-textbox" style="width:160px;" prompt="请输入品牌"/>
        </div>
        <label>型号：</label>
        <div>
            <input type="text" id="modelName" class="easyui-textbox"  style="width:160px;" prompt="请输入型号"/>
        </div>

        <div style="margin-top:5px;">
            <input type="text" id="orderId"  value="1" class="input-small" style=""/>
            自动搜索:<input id="modelFindSwitch" class="easyui-switchbutton" checked style="width:27%;height:30px;" onText="开" offText="关"  >
        </div>
        <div id="currentRecord"></div>
        <div id="left-side" class="list-wrapper" style="overflow-y:auto;max-height:70.4%">
            <ul id="similarmodel-list">
            </ul>
        </div>
        <!--</div>-->
    </div>

    <!-- 列表头部功能板块 -->
    <div data-options="region:'center'"  class="table-wrapper"style="padding:0px;background:#eee;height: 100%;">
        <div style="width: 100%">
            <div id="th">
                <div class="column-list-select" id="column-list-select">
                    <label for="analyzecategory"><input id="analyzecategory" type="checkbox" checked/>系统分析品类</label>
                    <label for="brandCode"><input id="brandCode" type="checkbox" checked/>品牌编码</label>
                    <label for="seriesCode"><input id="seriesCode" type="checkbox" >3C系列码</label>
                    <label for="modelCode"><input id="modelCode" data-options="editor:{type:'numberbox'}" type="checkbox" checked />型号编码</label>
                    <label for="brandmodel"><input id="brandmodel" type="checkbox" checked/>品牌型号</label>
                    <label for="namemodel"><input id="namemodel" type="checkbox" checked/>原名称型号</label>
                    <label for="comboRemark"><input id="comboRemark" type="checkbox" checked/>套餐备注</label>
                    <label for="channelName"><input id="channelName" type="checkbox" checked/>渠道</label>
                    <label for="amounts"><input id="amounts" type="checkbox" checked/>原/现/批发量</label>
                    <label for="prices"><input id="prices" type="checkbox" checked/>原/现/均价</label>
                    <label for="mallName"><input id="mallName" type="checkbox" checked/>商场</label>
                    <label for="user"><input id="user" type="checkbox" checked/>操作人</label>
                </div>
                <form id="updateff">
                    <div class="toolbar">
                        <input type="button" class="easyui-linkbutton" value="启用" onclick="enableAll()" style="height: 32px;width: 3%;margin-right:0.5%;border-right-color: #95b8e7;"/>
                        <input type="button" class="easyui-linkbutton" value="特殊禁用" onclick="disablePeriod()" style="height: 32px;width: 4%;margin-right:0.5%;border-right-color: #95b8e7;"/>
                        <input type="button" class="easyui-linkbutton" value="sku禁用" onclick="disableAll()" style="height: 32px;width: 4%;margin-right:0.5%;border-right-color: #95b8e7;"/>
                        <input type="button" class="easyui-linkbutton" value="追加禁用" onclick="openaddDisable()" style="height: 32px;width: 4%;margin-right:1.5%;"/>

<!--                        <input type="button" class="easyui-linkbutton" value="数据标记" onclick="dataMark()" style="height: 32px;width: 4%;margin-right:0.5%;border-right-color: #95b8e7;"/>-->
<!--                        <input type="button" class="easyui-linkbutton" value="取标" onclick="cancelMark()" style="height: 32px;width: 3%;margin-right:0.5%;border-right-color: #95b8e7;"/>-->
                        <input type="button" class="easyui-linkbutton" value="标记转移" onclick="markTransfer()" style="height: 32px;width:4%;margin-right:1.0%;border-right-color: #95b8e7;"/>

                        <input type="button" class="easyui-linkbutton" value="设置空型号" onclick="setEmptyModel()" style="height: 32px;width:5%; margin-right:0.5%;border-right-color: #95b8e7;"/>
                        <input type="button" class="easyui-linkbutton" value="取消空型号" onclick="cancelEmptyModel()" style="height: 32px;width:5%;margin-right:1.0%;border-right-color: #95b8e7;"/>

                        <input type="button" class="easyui-linkbutton c0" onclick="autoDisable()" value="一键禁用" style="height: 32px;width:4%; margin-right:0.5%;"/>
                        <input type="button" class="easyui-linkbutton " onclick="Identify()" value="识别" style="height: 32px;width:3%; margin-right:1.5%;"/>

                        <input type="button" class="easyui-linkbutton c0" onclick="batchUpdatePrice()" value="一键调价" style="height: 32px;width:4%; "/>
                        <input type="text" class="easyui-textbox" id="minNum"  value="0.5" style="width: 30px;height:30px;" />
                        <input type="text" class="easyui-textbox" id="maxNum"  value="1.6" style="width: 30px;height:30px;" />

                        <input type="button" class="easyui-linkbutton c0" onclick="comboQuery()" value="套餐查询" style="height: 32px;width:4%;margin-left:1.0%; "/>
                        <a href="javascript:void(0)" class="easyui-linkbutton" onclick="openComboKeywordsDialog()" iconCls="icon-edit" style="height: 30px; margin-right:1.0%;"></a>
<!--                        <input type="button" class="easyui-linkbutton" onclick="openComboKeywordsDialog()" value="套餐设置" style="height: 32px;width:4%; margin-right:1.0%;"/>-->

                    </div>
                    <div class="toolbar" >
                        <input type="button" class="easyui-linkbutton" value="合并" onclick="joinAll()" style="height: 32px;width: 3%;margin-right:0.5%;border-right-color: #95b8e7;"/>
                        <input type="button" id="merge" class="easyui-linkbutton" value="合并Plus" onclick="autoMerge()" style="height: 32px;width: 4%;margin-right:0.5%;border-right-color: #95b8e7;"/>
                        <input type="button" class="easyui-linkbutton" value="复制" onclick="cloneOne()" style="height: 32px;width: 4%;margin-right:0.5%;border-right-color: #95b8e7;"/>
                        <input type="button" class="easyui-linkbutton" value="均价禁用" onclick="avgPriceDisable()" style="height: 32px;width:4% ;margin-right:1.5%;border-right-color: #95b8e7;"/>

                        <select class="easyui-combobox" id="markModelOrBrand" name="markType" data-options="panelHeight:'auto'" style="width: 4.3%">
                            <option value="model" selected="selected">型号</option>
                            <option value="brand">品牌</option>
                        </select>
                        <input type="text" id="markValue" name="markValue" class="easyui-textbox" style="width: 5.35%"/>
                        <input type="button" class="easyui-linkbutton" onclick="mark()" value="标记" style="height: 32px;width:3%"/>

                        <input class="easyui-combobox" name="categoryCode" id="categorybox" data-options="panelHeight:150" style="width:8%"/>
                        <input type="button" class="easyui-linkbutton" onclick="moveTo()" value="转移" style="height: 32px;width:3%;margin-right:1.5%;"/>

                        <input type="button" class="easyui-linkbutton" value="一键处理" onclick="pdkBatchHandle()" style="height: 32px;width:4% ;margin-right:0.5%;border-right-color: #95b8e7;" id = "pdkBatchHandleButton"/>
                        <input type="button" class="easyui-linkbutton" onclick="noneHandle()" value="空型号处理" style="height: 32px;width:5%"/>
                    </div>
                    <div class="toolbar"  style="border:1px solid #95B8E7;">
                        <select id="changeTo" name="updateType" class="easyui-combobox" style="width:10%;"  prompt="请选择调整方式">
                            <option value=""></option>
                            <option value="T1">1.1 手动调成(整数)</option>
                            <option value="T2">1.2 手动调成(系数)</option>
                            <!--<option value="T3">1.3 手动调整(不移批发)</option>-->
                            <!--<option value="T4">1.4 批发移零售</option>-->
                            <!--<option value="T5">2.1 无型号</option>-->
                            <!--<option value="T6">2.2 型号不全</option>-->
                            <!--<option value="T7">2.3 其他</option>-->
                            <!--<option value="T8">3.1 不保留</option>-->
                            <option value="T9">3.2 个位保留</option>
                            <option value="T10">3.3 十位保留</option>
                            <option value="T11">3.4 百位保留</option>
                            <option value="T12">4.1 撤销更改销量</option>
                            <option value="T13">4.2 撤销更改价格</option>
                            <!--<option value="T14">4.3 更改商场码</option>-->
                            <!--<option value="T15">4.4 更改渠道码</option>-->
                            <!--<option value="T16">5.1 批发量=0</option>-->
                            <!--<option value="T17">5.2 批发价=0</option>-->
                            <!--<option value="T18">5.3 单价=0</option>-->
                            <option value="T19">5.4 单价=单价/销量</option>
                            <option value="T20">5.5 单价=单价*销量</option>
                            <option value="T21">5.6 单价=单价-整数</option>
                            <option value="T22">5.7 单价=单价*系数</option>
                            <option value="T23">5.8 单价=均价*系数</option>
                            <option value="T24">5.9 单价<=均价</option>
                            <!--<option value="T25">5.10 单价<=批发价</option>-->
                            <!--<option value="T26">5.11 电商单价=均价*系数</option>-->
                            <!--<option value="T27">5.12 批发价<=单价</option>-->
                            <option value="T28">5.13 销量=销量*系数</option>
                            <!--<option value="T29">5.14 单价=指定数*系数</option>-->
                        </select>
                        <input type="text" id="number" name="number" class="easyui-textbox" style="width: 3%" prompt="指定数" />
                        <input type="text" id="changeValue" name="changeValue" class="easyui-textbox"  style="width: 3%" prompt="数值"/>
                        <input type="button" class="easyui-linkbutton" onclick="adjustment()" value="调整" style="height: 32px;;width:3.3%;margin-right:1.5%"/>

                        套餐选择：
                        <select id="comboMultipleSelect1" class="easyui-combobox" style="width:12%;" data-options="multiple:true,
                        icons:[{iconCls:'icon-add',handler: function () { addCombobox()}}]"></select>
                        <input type="text" id="comboMultipleSelectNum1" class="easyui-textbox" style="width: 2.5%" prompt="数量" />
                        <input id="markComboButton" type="button" class="easyui-linkbutton" value="标记套餐" onclick="markAsMeal()" style="height: 32px;width:4%"/>
                        <input type="button" class="easyui-linkbutton" value="取消套餐" onclick="cancelMeal()" style="height: 32px;width:4%"/>
                        <input type="button" class="easyui-linkbutton c4" value="拆分套餐" onclick="splitMeal()" style="height: 32px;width:4%"/>

                    </div>
                </form>
            </div>

        </div>
        <table id="datagrid" idField="id" style="width:100%;height: 100%" data-options="fitColumns:true,scrollbarSize:0">
            <thead></thead>
            <tbody></tbody>
        </table>
    </div>

    <!-- 弹窗(追加禁用原因) -->
    <div id="addDisable" class="easyui-dialog"  style="height:200px;width:350px;"
         title="追加禁用库原因" iconCls="icon-ok"
         toolbar="#dlg-toolbar" buttons="#dlg-buttons" closed="true">
        <label class="item-label">禁用原因：</label>
        <select id="special" name="special" class="easyui-combobox" data-options="panelHeight:'auto'" style="width:90px;;" prompt="选值">
            <option value="true">是</option>
            <option value="false">否</option>
        </select>
        <div style="margin-top: 10px">
            <label class="item-label">禁用关键字：</label>
            <input type="text" id="remark" name="remark" value="1" class="easyui-textbox" data-options="panelHeight:'150'" style="width:220px;" />

        </div>
        <div style="margin-top: 20px">
            <a href="javascript:void(0);" style="margin-left:132px;width:80px;" class="easyui-linkbutton c8" onclick="addDisableMatch()">确定</a>
        </div>
    </div>

    <!-- 弹窗(填充型号) -->
    <div id="addModelNone" class="easyui-dialog"  style="padding:5px;height:810px;"
         title="填充型号" iconCls="icon-ok"
         toolbar="#dlg-toolbar" buttons="#dlg-buttons" closed="true">
        <div class="easyui-container-fluid" >
            <div class="imgAnalyzeDiv" id="imgAnalyzeDiv">
                <label class="item-label">识别信息：</label>
                <select class="easyui-combobox" id="imgAnalyzeSelect" style="width:150px;" ></select>
                <a class="easyui-linkbutton c8" href="javascript:void(0);" onclick="imgModelConfirm()" style="width:50px;margin-left: 3px;display: none" id="imgModelConfirm">确认</a>
                <a class="easyui-linkbutton" href="javascript:void(0);" onclick="cleanAnalyze()" style="width:45px;margin-left: 3px;">clean</a>
                <a class="easyui-linkbutton c2" href="javascript:void(0);" onclick="againAnalyze()" style="width:90px;margin-left: 3px;">重新识别</a>
                <input class="easyui-searchbox" data-options="prompt:'Please Input',searcher:imgSearch" style="width:150px" id="inputSearch"/>
            </div>

            <div class="jdImg" id="jdImg"></div>
            <!--<div class="imgAnalyze" id="img_content"></div>-->
            <div class="propDetail" id="propDetail" >
                <table id="propTable" cellspacing="0">
                </table>
            </div>
            <div class="easyui-panel" style="border: none;">
                <div class="easyui-panel" style="border:none;">
                    <form id="filling">
                        <div style="margin-bottom:10px;">
                            <input id="dataId" style="display: none" />
                            <label class="item-label"><span class="item-required">*</span>品类：</label>
                            <select class="easyui-combobox" id="categorySelectAdd" name="categoryCode" style="width:192px;" required="required" >
                            </select>
                            <label class="item-label"><span class="item-required">*</span>品牌：</label>
                            <select class="easyui-combobox" id="brandSelectAdd" name="brandCode" validType="notNull['#brandSelectAdd']" style="width:192px;"  required="required" prompt="--请选择--" data-options="icons: [{ iconCls: 'icon-reload', handler: function (e) { aa() }}]"></select>
                            <a class="easyui-linkbutton c8" href="javascript:void(0);" onclick="searchBymodelf()" style="width:90px;margin-left: 19px;">型号确认</a>&nbsp;&nbsp;
                        </div>
                        <div style="margin-bottom:10px;">
                            <label id="modelNameDiv">
                                <label class="item-label"><span class="item-required">*</span>颜色名：</label>
                                <input type="text" class="easyui-textbox" name="name" id="modelNameNew" data-options="required:true" style="width:192px;" prompt="请输入颜色名"/>
                            </label>
                            <label class="item-label"><span class="item-required">*</span>型号：</label>
                            <input type="text" class="easyui-textbox" name="parentName" id="parentName" style="width: 192px" data-options="required:true"/>
                            <select class="easyui-combobox" id="seriesTo3cCode" name="seriesTo3cCode" style="width:192px;display: none" prompt="请输入型号名"></select>
                            <label class="item-label" ><span class="item-required">*</span>规格状态：</label>
                            <select name="propStatus" class="easyui-combobox" style="width: 100px" data-options="required:true,panelHeight:'auto'"  style="width:100px;" >
                                <option value="CONFIRMONE" selected>部分确认</option>
                                <!--<option value="CONFIRMTWO">两级</option>-->
                                <!--<option value="CONFIRMTHREE">三级</option>-->
                                <option value="CONFIRMALL">全部确认</option>
                                <option value="UNCOFIRMED">未确认</option>
                                <option value="UNABLECOFIRED">无法找到信息</option>
                                <option value="UNRELEASED">暂未发布</option>
                            </select>
                        </div>
                        <div style="margin-bottom:10px;">
                            <label class="item-label"></span>原始型号：</label>
                            <input type="text" class="easyui-textbox" id="originalModelAdd" style="width:482px;"/>
                            <a class="easyui-linkbutton c8" href="javascript:void(0);" onclick="imgNext()" style="width:50px;margin-left: 19px;">next</a>
                        </div>
                        <div style="margin-bottom:10px;">
                            <label class="item-label">本品类系列：</label>
                            <input type="text" class="easyui-textbox" name="series" id="series" style="width: 192px"/>
                            <label class="item-label" >跨品类系列：</label>
                            <input type="text" class="easyui-textbox" prompt="请输入系列名" name="crossSeries" style="width: 192px"  />
                        </div>
                        <div style="margin-bottom:10px;">
                            <label class="item-label" >上市年份：</label>
                            <input type="text" class="easyui-numberbox" name="onSellYear" id="onSellYear" style="width: 192px" />
                            <label class="item-label" ><span class="item-required">*</span>上市价格：</label>
                            <input type="text" class="easyui-numberbox" data-options="required:true" prompt="请输入上市价格" name="onSellPrice" style="width: 192px" />
                        </div>
                        <div style="margin-bottom:10px;">
                            <label class="item-label" >上市月：</label>
                            <input type="text" class="easyui-numberbox" name="onSellMonth" id="onSellMonth" style="width: 192px" />
                            <label class="item-label" >上市周：</label>
                            <input type="text" class="easyui-numberbox" name="onSellWeek" id="onSellWeek" style="width: 192px"/>
                        </div>
                        <div style="margin-bottom:10px;">
                            <label class="item-label">别名：</label>
                            <input name="otherNames" class="easyui-tagbox" value="" style="width:482px;min-height:60px;" data-options="multiline:true"/>
                        </div>
                        <div style="margin-bottom:10px;">
                            <label class="item-label">卖点：</label>
                            <input name="sellMerit"  class="easyui-tagbox" value="" style="width:482px;min-height:60px;" data-options="multiline:true"/>
                        </div>
                        <div style="margin-bottom:10px;display: flex;">
                            <div style="display:inline">
                                <label class="item-label">描述：</label>
                                <input type="text" class="easyui-tagbox" name="description"  id="description" data-options="multiline:true" style="width:482px;min-height:60px"/>
                            </div>
                            <div style="display:inline-block;width: 150px;margin-left:19px">
                                <a class="easyui-linkbutton c8" href="javascript:void(0);" onclick="showImage()" style="width: 60px">图片</a>
                                <a class="easyui-linkbutton c8" href="javascript:void(0);" onclick="imageAnalyze()" style="width: 60px">识别</a>
                                <a class="easyui-linkbutton c8" href="javascript:void(0);" onclick="tzwy()" style="width: 60px">跳转</a>
                                <a class="easyui-linkbutton c8" href="javascript:void(0);" onclick="copyUrl()" style="width: 60px">复制</a>
                            </div>
                        </div>
                        <div>
                            &nbsp;&nbsp;<span style="font-weight: 900 ;font-size:20px; width: 100px" >卖点数据：</span>
                        </div>
                        <div style='margin-bottom:10px;'>
                            <label class="item-label">卖点0：</label>
                            <input name="sellingPoint0" class="easyui-textbox" value="" style="width:482px;"/>
                            <a class="easyui-linkbutton c8" href="javascript:void(0);" onclick="toggleSellingPoints()" style="margin-left: 15px; width: 60px" id="toggleSellingPointBtn">收起</a>
                        </div>
                        <div id="sellingPointWrapper" style="width: 740px;">
                        </div>
                        <div >
                            &nbsp;&nbsp;<span style="font-weight: 900 ;font-size:20px; width: 100px" >规格数据：</span>
                        </div>

                        <div id="categoryMetadataFilling1" style="width: 740px"></div>
                        <div style="margin-bottom:10px;margin-left:100px;">
                            <a href="javascript:void(0)" class="easyui-linkbutton c8" onclick="submitForm()" style="width:80px">保存</a>
                            <a href="javascript:void(0)" class="easyui-linkbutton" onclick="cancel()" style="width:80px">取消</a>
                            <a href="javascript:void(0)" class="easyui-linkbutton c3" onclick="defaultMetadataValue('categoryMetadataFilling1')" style="width:80px">默认</a>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>

    <!-- 弹窗(添加型号别名) -->
    <div id="addModelParticiple" class="easyui-dialog"  style="padding:5px;width:630px;height:300px;"
         title="型号加别名" iconCls="icon-ok"
         toolbar="#dlg-toolbar" buttons="#dlg-buttons" closed="true">
        <div class="easyui-container-fluid">
            <div class="easyui-panel" style="border: none;">
                <div class="easyui-panel" style="border:none;">
                    <form id="formParticiple">
                        <div style="margin-bottom:20px;">
                            <label class="item-label"></span>描述：</label>
                            <input type="text" class="easyui-textbox" id="originalModelPar" style='width:458px;'/>
                        </div>
                        <div style="margin-bottom:20px;">
                            <input id="otherNameDataId"  name ="id" style="display: none" />
                            <label class="item-label">型号码：</label>
                            <input type="text" class="easyui-textbox" name="modelCode" id="modelC" data-options="required:true" style='width:100px;'/>
                            <label class="item-label">型号名：</label>
                            <input type="text" class="easyui-textbox" name="modelName" id="modelN" data-options="required:true" style='width:260px;'/>
                        </div>
                        <div style="margin-bottom:20px;">
                            <label class="item-label"><span class="item-required">*</span>别名：</label>
                            <input name="otherName" id="otherName" type="text" class="easyui-textbox" data-options="required:true" style='width:458px;' />
                        </div>
                        <div style="margin-bottom:20px;" id="participleDiv">
                            <label class="item-label"><span class="item-required">*</span>分词：</label>
                            <select class='easyui-combobox' name='participle' id="participle" data-options="panelHeight:'auto'" style='width:458px;' ></select>
                        </div>
                        <div style="margin-bottom:20px;text-align: center;">
                            <a href="javascript:void(0)" class="easyui-linkbutton c6" onclick="addOtherNames()" style="width:80px">保存</a>
                            &nbsp;&nbsp;
                            <a href="javascript:void(0)" class="easyui-linkbutton c8" onclick="notAppendOtherNamesForm()" style="width:80px">不追加</a>
                            &nbsp;&nbsp;
                            <a href="javascript:void(0)" class="easyui-linkbutton" onclick="cancel()" style="width:80px;margin-right: 60px">取消</a>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>

    <!-- 弹窗(编码,填充型号存在时弹出) -->
    <div id="workDiv" class="easyui-dialog"  style="padding:5px;width:30%;height:26%;"
         title="编码模式" iconCls="icon-ok"
         toolbar="#dlg-toolbar" buttons="#dlg-buttons" closed="true">
        <div class="easyui-container-fluid">
            <div class="easyui-panel" style="border: none;">
                <form id="formWork">
                    <div style="margin-bottom:20px;">
                        <label class="item-label"></span>原始型号：</label>
                        <input type="text" class="easyui-textbox" id="originalModelWork" style='width:80%;'/>
                    </div>
                    <div style="margin-bottom:20px;">
                        <label class="item-label"></span>型号码：</label>
                        <input type="text" class="easyui-textbox" id="modelCodeWork" style='width:20%;'/>
                        <label class="item-label"></span>描述：</label>
                        <input type="text" class="easyui-textbox" id="searchMsg" style='width:30%;'/>
                    </div>
                    <div style="margin-bottom:20px;text-align: center;">
                        <a href="javascript:void(0)" class="easyui-linkbutton c8" onclick="workSearch()" style="width:80px">查询</a>
                        &nbsp;&nbsp;
                        <a href="javascript:void(0)" class="easyui-linkbutton" onclick="cancelWork()" style="width:80px;margin-right: 60px">取消</a>
                    </div>
                </form>
            </div>
        </div>
    </div>

    <!-- 套餐关键字 -->
    <!-- 修改套餐关键字弹窗 -->
    <div id="comboKeywordsDialog" class="easyui-dialog" style="width:50%;height:70%;padding:10px;"
         title="套餐关键字设置" closed="true" modal="true">
        <div style="margin:10px 0;">
            <div style="margin-bottom: 10px;">
                <label>现有关键字：</label>
                <input id="existingKeywords" class="easyui-tagbox" style="width:100%;min-height:100px"
                       data-options="
                       multiline:true,
                       editable: false,// 禁止编辑标签
<!--                       disabled: true,// 禁止操作标签-->
                       onClickTag: function(tag){
                           console.log('点击内容事件：' + tag);
                       },
                       onRemoveTag: function(tag){
                           console.log('删除内容事件：' + tag);
                           removeKeyword(tag);
                       },
                   ">
            </div>

            <div style="margin-bottom: 10px;">
                <label>待删除关键字：</label>
                <input id="deletedKeywords" class="easyui-tagbox" style="width:100%;min-height:50px;"
                       data-options="
                       multiline:true,
                       editable: false,// 禁止编辑标签
                       onClickTag: function(tag){
                           console.log('点击内容事件：' + tag);
                       },
                       onRemoveTag: function(tag){
                           console.log('删除内容事件：' + tag);
                           restoreKeyword(tag);
                       },
                   "/>
            </div>
            <div style="margin-bottom: 10px;">
                <label>添加新关键字(输入新关键字，按回车确认，可批量输入)：</label>
                <input id="newKeywords" class="easyui-tagbox" style="width:100%;height:50px;"
                       data-options="
                       prompt:'',
                       multiline:false
                   ">
            </div>
        </div>
        <div style="text-align:center;margin-top:20px;">
            <a href="javascript:void(0)" class="easyui-linkbutton" onclick="closeComboKeywordsDialog()">关闭</a>
            <a href="javascript:void(0)" class="easyui-linkbutton" onclick="saveComboKeywordsChanges()">保存</a>
        </div>
    </div>



</div>
</body>
<script type="text/javascript">
    var pageWeek;
    var pageMonth;
    var pageYear;
    var pageCategory;

    var onSellWeekToAdd;
    var onSellMonthToAdd;
    var onSellYearToAdd;
    var categoryCode;
    var categoryType;
    var currentIndex;   //当前工作台处理数据的坐标
    var globalData = [];
    var comboMultipleSelectCount = 1;
    var comboQueryFlag = false;
    $(function(){
        $('#ff .easyui-textbox,#comboCode').textbox({
            icons: [{
                iconCls: 'icon-clear', handler: function (e) {
                    $(e.data.target).textbox('clear');
                }
            }]
        });

        initgzCategorySelect("categorySelectAdd");
        $("#categorySelectAdd").combobox({disabled: true});

        $("#number").next().hide();
        if(window.parent.workMode.toUpperCase()=="PDK_W"||window.parent.workMode.toUpperCase()=="PDK_M"){
            $("#pdkBatchHandleButton").show();
        }else {
            $("#pdkBatchHandleButton").hide();
        }
    });
    $(function () {
        initPage();
        setNav();
        aRecords("工作台","/webapp/pages/product/workshop");
        var height = $(window).height();
        var nav_height = $("#nav")._outerHeight();
        var ff_height = $("#ff").height()+$("#filterff").height();
        var table_height = height-nav_height-ff_height-20;
        $("#datagrid").css("max-height",table_height);
        var fixedColumns = valueSets(columns_map);
        var dg_columns = fixedColumns;
        var dg = $("#datagrid").datagrid({
            rownumbers:true,
            pagination:true,
            idField:"id",
            checkOnSelect:false,
            columns:[dg_columns],
            onClickRow:function (index,row) {
                currentIndex = index;
                window.currentRecord = row;
                leftDirectionFun();
                return false;
            },
            onLoadSuccess:function (data) {

                var tableTd = $('div.datagrid-body td[field="channelCode"]'); //productname是列名
                tableTd.each(function () {
                    var $this = $(this);
                    var index = $this.parent('tr').attr('datagrid-row-index');
                    var rows = $('#datagrid').datagrid('getRows');
                    var currentRow = rows[index];
                    if(currentRow && currentRow.originalModel ){
                        var content = '<div style=" max-width:700px;word-break: break-all; word-wrap: break-word;">' + currentRow.originalModel + '</div>'; //productname是列名
                        $this.tips({ content: content, wrapColor: 'black' });
                    }
                });


                $("#datagrid").datagrid("clearChecked");
                var stats = "<div class='stats'><label>销量 ：{{totalCount}}</label>&nbsp;&nbsp;&nbsp;<label>金额 ：{{totalPrice}}</label>&nbsp;&nbsp;&nbsp;<label>均价 ：{{avgPrice}}</label></div>";
                stats = stats.replace("{{totalCount}}",globalData.map.totalCount);
                stats = stats.replace("{{totalPrice}}",globalData.map.totalPrice);
                stats = stats.replace("{{avgPrice}}",globalData.map.avgPrice);
                $(".datagrid-wrap").find(".stats").remove();
                //before：在div外的后面加入标签
                $(".datagrid-wrap").find(".datagrid-pager").find(".pagination-info").before(stats);

                $("#b1").remove();
                var totalStatus = $("#totalStatus").val();
                var value = totalStatus == "true" ? "ON" : "OFF";
                var color = totalStatus == "true" ? "black" : "red";
                var b1 = "<input type='button' id='b1' style='color: "+color+"' onclick='method1()' value='" + value + "'>";
                $(".datagrid-wrap").find(".datagrid-pager").find(".pagination-info").append(b1);

            },
            onDblClickCell: function (rowIndex, field, value) {
                var rows = $('#datagrid').datagrid('getRows');
                var row = rows[rowIndex];
                var id = row.id;
            },
            toolbar:"#th"
        }).datagrid("getPager").pagination({
            onSelectPage:searchBy
        });
        $(".column-list-select").delegate("input","click",function(e){
            var self = this;
            var columns = getColumns();
            $("#datagrid").datagrid({
                columns:[columns],
                data:globalData
            });
        });

        var modelName="";
        //监听键盘事件
        $(".table-wrapper").keyup(function (event) {
            var e = event || window.event;
            var keyCode = e.keyCode || e.which;
            if(keyCode=="37"){
                //只有在型号和品牌下,光标移动到搜索框
                var type=e.target.name;
                if(type=="model"||type=="brand"){
                    e.preventDefault();
                    $("#modelName").textbox('textbox').focus();
                    // leftDirectionFun();
                    console.log("<-1");
                }else{
                    console.log("<-");
                    //说明在价格上,不作处理
                    //(旧)移动到当前行的前一个输入框
                    // var parent = $(e.target).parents("tr");
                    // var input_tags = parent.find(".datagrid-text");
                    // var index = input_tags.index(e.target);
                    // index = index-1;
                    // if(index<0){
                    //     index = 0;
                    // }
                    // e.preventDefault();
                    // input_tags.eq(index).focus();
                    // input_tags.eq(index)[0].setSelectionRange(-1,-1);//解决位置的问题
                }
            }else if(keyCode=="38"){
                console.log("^");
                var ele = $(e.target);
                var type = e.target.name;
                var index2 = $("#datagrid").datagrid("getRowIndex",e.target.id);
                index2 = index2-1;
                if(index2<0){
                    index2 = 0;
                }
                var tr = $(".table-wrapper .datagrid-view2 table.datagrid-btable").find("tr").eq(index2);
                tr.find("input[name="+type+"]").focus();
                setTimeout(function () {
                    tr.find("input[name="+type+"]")[0].setSelectionRange(-1,-1);//解决位置的问题
                },10);

            }else if(keyCode=="39"){
                console.log("->");
                var type = e.target.name;
                if(type=="model"){
                    //根据当前型号刷新查询
                    var record = window.currentRecord ;//= $("#datagrid").datagrid("getSelected");
                    if(record){
                        modelName = record.originalModel;
                        selectRowByModelName(modelName);
                    }
                }else if (type == "brand") {
                    //光标跳转到右边的输入框上
                    var parent = $(e.target).parents("tr");
                    var input_tags = parent.find(".datagrid-text");
                    var index = input_tags.index(e.target);
                    index = index + 1;
                    if (index == input_tags.length) {
                        index = 0;
                    }
                    e.preventDefault();
                    input_tags.eq(index).focus();
                    input_tags.eq(index)[0].setSelectionRange(-1, -1);//解决位置的问题
                }

            }else if(keyCode=="40"){
                console.log("v");
                var ele = $(e.target);
                var type = e.target.name;
                var index2 = $("#datagrid").datagrid("getRowIndex",e.target.id);
                var tr = $(".table-wrapper .datagrid-view2 table.datagrid-btable").find("tr").eq(index2+1);
                tr.find("input[name="+type+"]").focus();
                if(type=="price"){
                    //输入框全选
                    tr.find("input").select();
                }
                //光标移动做完了
                //修改
                updateCurrentRow(e.target);
                //查询型号
                leftDirectionFun();
            }else if(keyCode=="13"){
                console.log("enter");
            }
        });
        $("#modelName").textbox('textbox').keydown(function (event) {
            var e = event||window.event;
            var keyCode = e.keyCode || e.which;
            if(keyCode=="13"){//回车
                var modelName = $("#modelName").textbox('getValue');
                if(!modelName){
                    //$.messager.alert("提示","请输入型号","warn");
                    return false;
                }else{
                    searchByModel(modelName,e.target);
                }
            }else if(keyCode=="40"){//DW 下键
                console.log("-v");
                $("#orderId").focus();
            }
        });

        $("#brandName").textbox('textbox').keydown(function (event) {
            var e = event||window.event;
            var keyCode = e.keyCode || e.which;
            if(keyCode=="13"){//回车
                var modelName = $("#brandName").textbox('getValue');
                if(!modelName){
                    //$.messager.alert("提示","请输入型号","warn");
                    return false;
                }else{
                    searchByModel(modelName,e.target,true);
                }
            }else if(keyCode=="40"){//DW 下键
                console.log("-v");
                $("#orderId").focus();
            }
        });
        // aaaaaaaaaaaaaaaa
        $("#orderId").keydown(function (event) {
            var e = event||window.event;
            var keyCode = e.keyCode || e.which;
            if(keyCode=="13"){
                var orderId = $(this).val();
                if(dataForSimilar.length==0){
                    //$.messager.alert("提示","没有可替换的记录","warn");
                    return false;
                }
                if(orderId==""){
                    //$.messager.alert("提示","请输入数值","warn");
                    return false;
                }
                if(isNaN(orderId)){
                    //$.messager.alert("提示","请输入正确的数值","warn");
                    return false;
                }
                if(orderId==0||(orderId>0&&orderId>dataForSimilar.length)){
                    //$.messager.alert("提示","请输入正确的序号","warn");
                    return false;
                }
                var record = dataForSimilar[orderId-1];
                batchReplace(window.currentRecord.id, record.code);
                // $("#originalModel").textbox("setValue","");  取消回车键清除原始型号关键字
                // searchBy();
                $('#addModelNone').dialog('close');
                searchBy();
            }else if(keyCode=="40"){
                // alert("下键+++++++++++++++++++++++++");
                var orderId = $(this).val();
                if(dataForSimilar.length==0){
                    //$.messager.alert("提示","没有可替换的记录","warn");
                    var index2 = $("#datagrid").datagrid("getRowIndex",window.currentRecord.id);
                    var tr = $(".table-wrapper .datagrid-view2 table.datagrid-btable").find("tr").eq(index2);
                    tr.find("input[name='model']").focus();
                    return false;
                }
                if(orderId==""){
                    //$.messager.alert("提示","请输入数值","warn");
                    return false;
                }
                if(isNaN(orderId)){
                    //$.messager.alert("提示","请输入正确的数值","warn");
                    return false;
                }
                if(orderId==0||(orderId>0&&orderId>dataForSimilar.length)){
                    //$.messager.alert("提示","请输入正确的序号","warn");
                    return false;
                }
                var record = dataForSimilar[orderId-1];
                //update current record
                if(record.code.length>=8){
                    var url = "/sales/detail/model/moveTo/"+record.code;
                }else{
                    var url = "/sales/detail/brand/moveTo/"+record.code;
                }

                var id = window.currentRecord.id;
                updateModelAndFocus(url,id);
                $('#addModelNone').dialog('close');
            }
        });
        //表格文本输入框光标事件
        $(".table-wrapper").delegate("input[type=text]","focus",function (e) {
            var index = $("#datagrid").datagrid("getRowIndex",e.target.id);
            if (index < 0) {
                return;
            }
            window.currentRecord = globalData.content[index];
        });
        //input type=text enter
        $("#ff").keydown(function (event) {
            var e = event || window.event;
            var keyCode = e.keyCode || e.which;
            if(keyCode=="13"){
                searchBy();
            }
        });
    });

    //左侧型号查找
    function leftDirectionFun() {
        var e = event||window.event;
        var record = window.currentRecord;
        if(record){
            if(record.modelCode){
                $("#currentRecord").html("<span>("+record.price+")</span>"+record.originalModel);
                $("#brandName").textbox("setValue",record.brandName);

                if(record.modelName){
                    $("#modelName").textbox("setValue", record.modelName);
                }
                //显示原始型号信息
                let modelFind = $("#modelFindSwitch").switchbutton("options").checked ? true : false;
                if (modelFind == false) {
                    return;
                }
                searchByModelOne(record.modelCode,e.target);
            }else{
                var modelName = record.originalModel;
                // modelName = modelName.replace(/\s*/g, "");
                if(!modelName)return false;
                $("#currentRecord").html("<span>("+record.price+")</span>"+modelName);
                $("#brandName").textbox("setValue",record.brandName);
                var modelreg = modelName.replace(/[\u4e00-\u9fa5]/g,"");
                modelreg = modelreg.replace(/\ /g,"");
                $("#modelName").textbox("setValue",modelreg);
                $("#similarmodel-list").html("");
                //显示原始型号信息
                let modelFind = $("#modelFindSwitch").switchbutton("options").checked ? true : false;
                if (modelFind == false) {
                    return;
                }
                searchByModel(modelreg,e.target);
            }
        }
    }
    function searchBy(page,size) {
        if(!$('#categorySelect').combobox("getValue")){
            $.messager.alert("提示","品类不能为空","info");
            return;
        };
        var dtd = $.Deferred();
        var data = getFormData(document.getElementById("ff"));
        data.reportType=window.parent.workMode.toUpperCase();
        pageCategory = $('#categorySelect').combobox("getValue");
        data.combocomparer= $('#combocomparer').combobox("getValue");
        data.comboCode = $('#comboCode').textbox("getValue");
        pageYear = data.year;
        data.categoryCode =  pageCategory;
        if (isMonthType()) {
            pageMonth = data.month;
        }else {
            pageWeek = data.week;
            if (!data.week) {
                data.week = window.parent.timeData.weekInYear;
            }
        }
        initOnSellYearMonth();
        var pager = {page:page,size:size};
        if(!size){
            pager['page']= 1;
            pager['size'] = $("#datagrid").datagrid("getPager").pagination("options").pageSize||100;
        }
        var jsonobj = buildJsonObject();
        jsonobj.dataTotal = $("#dataTotal").switchbutton("options").checked;
        jsonobj.entityStatus = $("#entityStatus").switchbutton("options").checked==true?"OK":"DISABLE";
        jsonobj.totalStatus = $("#totalStatus").val();

        if (comboQueryFlag) {
            //套餐查询按钮
            data.queryType = "Q27";
            comboQueryFlag = false;
        }

        jsonobj = $.extend(true,jsonobj,transfer(data));
        jsonobj = JSON.stringify(jsonobj);
        categoryCode = data.categoryCode;
        // jsonobj.recordMark="套";
        if (data.queryType == "Q16" || data.queryType == "Q21") {
            if (data.brandCode) {
                $.messager.alert("提示","品牌码和异常类型冲突","info");
                return;
            }
        }
        $.ajax({
            url:config.url + "/sales/detail/page?"+transfer2url(pager),
            type:'post',
            data:jsonobj,
            contentType:"application/json;charset=UTF-8",
            dataType:'json',
            xhrFields:{withCredentials:true},
            beforeSend:function () {
                $.messager.progress({
                    title:"请稍等",
                    interval:30,
                    text:"数据加载中..."
                });
            },
            complete:function () {
                $.messager.progress("close");
            },
            success:function (data) {
                $.messager.progress("close");
                if (data.code != null) {
                    $.messager.alert("提示",data.msg, "error");
                    return
                }
                if(data){
                    globalData = data;
                    categoryType = data.map.categoryType;
                    if (categoryType == 2) {
                        $("#seriesTo3cCode").next().show();
                        $("#series").next().hide();
                    }else {
                        $("#seriesTo3cCode").next().hide();
                    }
                    $("#datagrid").datagrid("loadData",data);
                    dtd.resolve();
                }
            },
            error:function (XMLHttpRequest,textStatus,errorThrown) {
                $.messager.progress("close");
                $.messager.alert("提示",XMLHttpRequest.responseJSON.message, "error");
            }
        });
        return dtd.promise();
    }
    function buildJsonObject() {
        var object = {};
        var integerFilters = [],floatFilters = [],stringFilters=[];
        var columnbox = $('#columnbox').combobox("getValue");
        var comparerbox = $('#comparerbox').combobox("getValue");
        var valuebox = $('#valuebox').textbox("getValue");
        if(columnbox&&comparerbox&&valuebox&&!isNaN(valuebox)){
            if (columnbox == "DISCOUNT_1" || columnbox == "DISCOUNT2_1"||columnbox == "DISCOUNT3_1"||
                columnbox == "DISCOUNT_2" || columnbox == "DISCOUNT2_2"||columnbox == "DISCOUNT3_2") {
                floatFilters.push({column: columnbox, comparer: comparerbox, value: valuebox});
            } else {
                integerFilters.push({column: columnbox, comparer: comparerbox, value: valuebox});
            }
        }

        columnbox = $('#columnbox2').combobox("getValue");
        comparerbox = $('#comparerbox2').combobox("getValue");
        valuebox = $('#valuebox2').textbox("getValue");
        if(columnbox&&comparerbox&&valuebox){
            if(columnbox == "OPERATE_USER"){
                stringFilters.push({column: columnbox, comparer: comparerbox, value: valuebox});
            }else if (!isNaN(valuebox)) {
                if (columnbox == "DISCOUNT_1" || columnbox == "DISCOUNT2_1"||columnbox == "DISCOUNT3_1"||
                    columnbox == "DISCOUNT_2" || columnbox == "DISCOUNT2_2"||columnbox == "DISCOUNT3_2") {
                    floatFilters.push({column: columnbox, comparer: comparerbox, value: valuebox});
                }else {
                    integerFilters.push({column: columnbox, comparer: comparerbox, value: valuebox});
                }
            }
        }



        var formdata = getFormData(document.getElementById("filterff"));
        /*var columns = formdata.column;
        var comparers = formdata.comparer;
        var values = formdata.value;
        var integerFilters = [],floatFilters = [];
        for(var i in columns){
            var column = columns[i];
            var comparer = comparers[i];
            var value = values[i];
            if(column&&comparer&&value&&!isNaN(value)){
                if (column == "DISCOUNT_1" || column == "DISCOUNT2_1"||column == "DISCOUNT3_1"||
                    column == "DISCOUNT_2" || column == "DISCOUNT2_2"||column == "DISCOUNT3_2") {
                    floatFilters.push({column: column, comparer: comparer, value: value});
                } else {
                    integerFilters.push({column: column, comparer: comparer, value: value});
                }
            }
        }*/
        if(integerFilters&&integerFilters.length>0){
            object.integerFilters = integerFilters;
        }else{
            object.integerFilters = [];
        }

        if(floatFilters&&floatFilters.length>0){
            object.floatFilters = floatFilters;
        }else{
            object.floatFilters = [];
        }

        if(stringFilters&&stringFilters.length>0){
            object.stringFilters = stringFilters;
        }else{
            object.stringFilters = [];
        }

        var metadataFilters = [];
        for(var key in formdata){
            if(!isNaN(key)){
                var prop = key;
                if(!formdata[key])continue;
                metadataFilters.push({code:key,value:formdata[key]});
            }
        }

        if(metadataFilters&&metadataFilters.length>0){
            object.metadataFilters = metadataFilters;
        }else{
            object.metadataFilters = [];
        }
        return object;
    }

    function method1() {
        var b1 = $("#b1").val();
        $("#b1").val(b1 == "ON" ? "OFF" : "ON");
        if(b1=="ON"){
            $("#b1").css("color","red");
            $("#totalStatus").val("false");
        }else {
            $("#b1").css("color","black");
            $("#totalStatus").val("true");
        }
    }

    //--------------------------------------填充型号页面--------------------------------------
    function addProp(categoryCode) {

        $.ajax({
            url:config.url+"/categoryMetadata/getMetadataUnderCategory?categoryCode="+categoryCode,
            type:'get',
            xhrFields:{withCredentials:true},
            success:function (data) {
                //规格数据填充
                var content = generateContent(data,true);
                $("#categoryMetadataFilling1").html(content);
                $.parser.parse($("#categoryMetadataFilling1"));

                //生成卖点数据
                generateSellingPointWrapper();
                //添加选择事件,用于规格排除
                propExcludeInit();
                //规格排除的字段添加默认值
                propExcludeDefault();
                //针对特殊品类的规格处理
                specialProp();
            }
        });
    }
    //规格值填充
    function initFormDataNone(id){
        if(id){
            $.ajax({
                url:config.url +"/workshop/getNodeModelByDataId",
                type:'get',
                data:{dataId:id},
                xhrFields:{withCredentials:true},
                success:function(data){
                    //填充表单
                    if(data){
                        var formdata = changeProperty2String(data);
                        if(!formdata.otherNames){
                            formdata.otherNames=[];
                        }
                        if(!formdata.sellMerit){
                            formdata.sellMerit=[];
                        }

                        if(formdata.properties){
                            var props = formdata.properties;
                            for(var i in props){
                                if(props[i].value){
                                    $("#c"+props[i].code).attr("class","item-label");
                                }
                                if(props[i].value&& -1==props[i].value){
                                    formdata[props[i].code] = "-1";
                                }else{
                                    formdata[props[i].code] = props[i].value;
                                }
                                if("boolean"==(typeof props[i].value)){
                                    formdata[props[i].code] = props[i].value.toString();
                                }
                            }
                        }
                        if (!formdata.brandCode) {
                            delete formdata.brandCode;
                        }
                        $("#filling").form("load",formdata);
                        //model brand readonly
                        $("#categorySelectAdd").combobox("readonly",true);
                    }
                },
                error:function(){

                }
            });
        }
        // $("#categorySelectAdd").combobox("select",categoryCode);
    }
    function submitForm(){
        var id=document.getElementById("dataId").value;
        $("#filling").form("submit",{
            onSubmit:function(){
                var valid = $(this).form('enableValidation').form('validate');
                if(!valid)return false;
                var formData = getFormData(document.getElementById("filling"));
                var method = "POST";
                formData.dataId=id;
                formData.name = $("#modelNameNew").textbox("getValue");     //解决getFormData()会将部分特俗字符转义
                if(formData['otherNames'] && typeof formData['otherNames'] === 'string'){
                    formData['otherNames'] = [formData['otherNames']]
                }
                if(formData['sellMerit'] && typeof formData['sellMerit'] === 'string'){
                    formData['sellMerit'] = [formData['sellMerit']]
                }
                //卖点数据
                var sellingPointList = [];
                for(var i = 0; i < 10; i++){
                    var sellingPoint = formData['sellingPoint'+i];
                    sellingPointList.push(sellingPoint);
                }
                formData['sellingPointList'] = sellingPointList;
                var properties = [];
                for(var i in formData){
                    if(!isNaN(i)&&formData[i]){
                        //排除掉隐藏的规格
                        if(propExcludeMap.has(i)&&propExcludeMap.get(i)>0){
                            continue;
                        }
                        properties.push({code:i,value:formData[i]});
                    }
                }
                formData['properties'] = properties;
                // formData['description'] = $("#description").textbox('getValue');
                var description = [];
                var wz = $("#description").tagbox('getValues');
                wz.forEach(function(v){
                    description.push(v);
                });
                formData['description'] = description;
                //验证系列
                var series = formData["series"];
                var reg = /^(\w|[\u4E00-\u9FA5]|\(|\)|\/|-)*$/;
                if (series) {
                    if (series.length > 20) {
                        $.messager.alert("提示","【系列】长度不能超过20个字符","error");
                        return;
                    }
                    // else if(!series.match(reg)){
                    //     $.messager.alert("提示","【系列】不能含有\"()/-\"以外的特殊符号","error");
                    //     return;
                    // }
                }

                if(formData['onSellPrice']<=0){
                    $.messager.alert("提示","上市价格不能小于等于0","error");
                    return;
                }
                /**
                 * 设置默认的上市年月
                 * 1.若是周报/电商数据，上市周为当前处理的周数，上市月以周数为标准
                 * 2.若是月报数据，上市月为当前处理的月数，上市周以月数最后一周为标准
                 */
                if (!formData['onSellYear']) {
                    formData['onSellYear'] = onSellYearToAdd;
                }
                if (!formData['onSellMonth']) {
                    formData['onSellMonth'] = onSellMonthToAdd;
                }
                if (!formData['onSellWeek']) {
                    formData['onSellWeek'] = onSellWeekToAdd;
                }
                formData.categoryCode=$("#categorySelectAdd").combobox('getValue');
                if (categoryType == 2) {
                    if(!formData['seriesTo3cCode']){
                        $.messager.alert("提示","请选系列名","error");
                        return;
                    }
                }
                $.ajax({
                    url:config.url+"/workshop/saveModel",
                    type:method,
                    data:JSON.stringify(formData),
                    dataType:'json',
                    contentType:'application/json;charset=UTF-8',
                    xhrFields:{withCredentials:true},
                    beforeSend:function(){
                        $.messager.progress({
                            title:"请稍等",
                            interval:50,
                            text:"操作进行中..."
                        });
                    },
                    success:function(data){
                        $.messager.progress("close");
                        if(data.code == 200){
                            $('#addModelNone').dialog('close');
                            $.messager.alert("提示",data.msg,"info",function(){
                                // $('#addModelNone').dialog('close');
                                searchBy();
                            });
                        }else{
                            if (categoryType == 2 && data.msg.indexOf("型号已存在") >= 0) {
                                let modelCode = data.msg.substr(6, 8);
                                $.messager.confirm("提示", "型号已存在("+modelCode+")，是否编码?", function (r) {
                                    if (r) {
                                        var url = "/sales/detail/model/moveTo/" + modelCode;
                                        updateModelAndFocus(url, id);
                                        searchBy();
                                        $('#addModelNone').dialog('close');
                                    }
                                })

                            }else {
                                $.messager.alert("错误",data.msg,"error");
                            }

                        }
                    },
                    error:function(XMLHttpRequest,textStatus,thrown){
                        // $.messager.alert("提示","操作失败","error");
                    }
                });
                return false;
            }
        });
    }

    function workSearch() {
        let msg = $("#searchMsg").textbox("getValue");
        if (msg) {
            $("#originalModel").textbox("setValue", msg);
        }
        $('#workDiv').dialog('close');
        var flag = copyText($("#modelCodeWork").textbox("getValue"));
        $.messager.show({
            title: '提示',
            msg: flag?"型号码已复制":"型号码失败",
            timeout: 1000,
            showType: 'fade'
        });
        searchBy();
    }

    function cancelWork() {
        $("#originalModel").textbox("setValue", "");
        $('#workDiv').dialog('close');
        searchBy();
    }
    function cancel(){
        // $('#filling').form('clear');
        $('#addModelNone').dialog('close');
        $('#addModelParticiple').dialog('close');

    }
    // 提交上传文件
    $(function() {
        $("#sub").click(function () {
            // var form = new FormData(document.getElementById("file_form"));
            // alert(form);
            $("#file_form").ajaxSubmit({
                xhrFields:{withCredentials:true},
                url:config.url +"/workshop/uploadModelNone",
                type:"POST",
                dataType : "text",
                data:$('#file_form').serialize(),
                processData: false,
                beforeSend:function () {
                    $.messager.progress({
                        title:"请稍等",
                        interval:20,
                        text:"操作进行中..."
                    });
                },
                complete:function () {
                    $.messager.progress("close");
                },
                success : function(data) {
                    $("#upmall").window("close");
                    searchBy();
                    $.messager.alert("提示",data);
                }
            })
        })
    });

    $("#thisPeriod").combobox({
        onChange:function () {
            var value = $("#thisPeriod").combobox("getValue");
            if(value=="true"){
                $("#top").next().show();
            }else{
                $("#top").next().hide();
            }
        }
    });

    $("#changeTo").combobox({
        onChange:function () {
            var value = $("#changeTo").combobox("getValue");
            if(value=="T29"){
                $("#number").next().show();
            }else{
                $("#number").next().hide();
            }
        }
    });
    /**
     * 初始化型号添加的上市年月
     * 1.若是周报/电商数据，上市周为当前处理的周数，上市月以周数为标准
     * 2.若是月报数据，上市月为当前处理的月数，上市周以月数最后一周为标准
     */
    function initOnSellYearMonth() {
        onSellYearToAdd = pageYear;
        if (isMonthType()) {
            onSellMonthToAdd = pageMonth;
            onSellWeekToAdd = getWeekNumByMonth(onSellYearToAdd, onSellMonthToAdd);
        } else {
            onSellWeekToAdd = pageWeek;
            onSellMonthToAdd = getMonthByWeekNum(onSellYearToAdd, onSellWeekToAdd);
        }
        $('#onSellYear').numberbox({prompt:onSellYearToAdd});
        $('#onSellMonth').numberbox({prompt:onSellMonthToAdd});
        $('#onSellWeek').numberbox({prompt:onSellWeekToAdd});
    }

    $("#unusualcombobx").combobox({
        onChange:function () {
            var value = $("#unusualcombobx").combobox("getValue");
            if(value=="Q20"){
                $("#notAppend").show();
            }else{
                $("#notAppend").hide();
            }
        }
    });
    $("#addModelParticiple").keydown(function (event) {
        var e = event || window.event;
        var keyCode = e.keyCode || e.which;
        // console.log(keyCode);
        if (keyCode == 13) {
            //回车键
            addOtherNames();
        }else if(keyCode == 27){
            //esc
            $('#addModelParticiple').dialog('close');
        }
    });

    $("#participleDiv").keydown(function (event) {
        var e = event || window.event;
        var keyCode = e.keyCode || e.which;
        // console.log(keyCode);
        if (keyCode == 39) {
            //→键
            $("#otherName").textbox('textbox').focus();
        }else if(keyCode == 32){
            //空格
            $('#participle').combobox('setValue', "");
        }else if(keyCode == 37){
            //左键
            notAppendOtherNamesForm();
        }
    });

    $("#addModelNone").attr('tabindex', 1).keydown(function (event) {
        var e = event || window.event;
        var keyCode = e.keyCode || e.which;
        // console.log(keyCode);
        if (keyCode == 27) { //esc
            $('#addModelNone').dialog('close');
        }
    });

    function notAppendOtherNamesForm() {
        var id = $("#otherNameDataId").val();
        if (!id) {
            $.messager.alert("提示", "找不到id", "error");
            return;
        }
        notAppendOtherNames(id);
    }
    //打开原因
    function openaddDisable() {
        $("#remark").textbox('setValue','')
        $('#addDisable').dialog('open');
    }
    //一键禁用
    function autoDisable() {
        var data = getFormData(document.getElementById("ff"));
        if (!isMonthType() && !data.week) {
            data.week = window.parent.timeData.weekInYear;
        }
        data.reportType = window.parent.workMode.toUpperCase();
        if($('#categorySelect').combobox("getValue")){
            data.categoryCode =  $('#categorySelect').combobox("getValue");
        }else{
            $.messager.alert("提示","品类不能为空","info");
            return;
        }
        $.messager.confirm("提示", "您确定要执行一键禁用么？", function (r) {
            if (r) {
                $.ajax({
                    url: config.url + "/workshop/autoDisable",
                    type: "post",
                    data: {'year': data.year,
                        'month': data.month,
                        'reportType': data.reportType,
                        'categoryCode': data.categoryCode,
                        'week': data.week},
                    dataType: "json",
                    xhrFields: {withCredentials: true},
                    beforeSend: function () {
                        $.messager.progress({
                            title: "请稍等",
                            interval: 50,
                            text: "数据加载中..."
                        });
                    },
                    complete: function () {
                        $.messager.progress("close");
                    },
                    success: function (result) {
                        $.messager.progress("close");
                        if (result.code == "200") {
                            $.messager.alert("提示", result.msg, "info");
                            searchBy();
                        } else {
                            $.messager.alert("提示", result.msg, "error");
                        }
                    },
                    error: function (result) {
                        $.messager.alert("提示", result.msg, "error");
                    }
                })
            }
        });
    }
    $('#dd').tooltip({
        position: 'right',
        content: '<span style="color:#fff">This is the tooltip message.</span>',
        onShow: function(){
            $(this).tooltip('tip').css({
                backgroundColor: '#666',
                borderColor: '#666'
            });
        }
    })

    $('#markModelOrBrand').combobox({
        onSelect: function(record){
            if (record.value == "model") {
                $("#markValue").textbox({prompt: '型号码'});
            } else if (record.value == "brand") {
                $("#markValue").textbox({prompt: '品牌码'});
            }
        }
    });

    function addCombobox(){
        comboMultipleSelectCount++;
        var comboId = "comboMultipleSelect" + comboMultipleSelectCount;
        var comboNumId = "comboMultipleSelectNum" + comboMultipleSelectCount;
        var newContent = "<select id=\""+comboId+"\" class=\"easyui-combobox\" style=\"width:12%;\" data-options=\"multiple:true,\n" +
            "                        icons:[{iconCls:'icon-add',handler: function () { addCombobox()}}]\"></select>" +
            "<input type=\"text\" id=\""+comboNumId+"\" class=\"easyui-textbox\" style=\"width: 2.5%\" prompt=\"数量\" />";
        $('#markComboButton').before(newContent);
        initgzCategorySelect(comboId);
        $('#'+comboNumId).textbox();
    }
    function removeCombobox(){
        if (comboMultipleSelectCount <= 1) {
            return;
        }
    }

    function comboQuery(){
        comboQueryFlag = true;
        searchBy();
    }

    // 打开套餐关键字设置弹窗
    function openComboKeywordsDialog() {
        categoryCode = $('#categorySelect').combobox("getValue");
        if(!categoryCode){
            $.messager.alert("提示","品类不能为空","info");
            return;
        }
        // 清空所有输入框
        $('#newKeywords').tagbox('clear');
        $('#existingKeywords').tagbox('clear');
        $('#deletedKeywords').tagbox('clear');

        // 调用接口获取所有关键字
        $.ajax({
            url: config.url + "/combo/keywords/getAll/"+categoryCode,
            type: "GET",
            xhrFields: {withCredentials: true},
            success: function(result) {
                if (result.code != 200) {
                    $.messager.alert("提示", result.msg, "error");
                    return;
                }
                // 将获取到的关键字显示在现有关键字框中
                $('#existingKeywords').tagbox('setValues', result.data || []);
                // 初始化待删除关键字为空
                $('#deletedKeywords').tagbox('setValues', []);
            },
            error: function() {
                $.messager.alert('提示', '获取关键字失败', 'error');
            }
        });

        // 打开弹窗
        $('#comboKeywordsDialog').dialog('open');
    }

    // 移除关键字（将关键字移到待删除区域）
    function removeKeyword(tag) {
        // 从现有关键字中移除
        var existingKeywords = $('#existingKeywords').tagbox('getValues');
        var index = existingKeywords.indexOf(tag);
        if (index > -1) {
            existingKeywords.splice(index, 1);
            $('#existingKeywords').tagbox('setValues', existingKeywords);

            // 添加到待删除关键字中
            var deletedKeywords = $('#deletedKeywords').tagbox('getValues');
            if (deletedKeywords.indexOf(tag) === -1) {
                deletedKeywords.push(tag);
                $('#deletedKeywords').tagbox('setValues', deletedKeywords);
            }
        }
    }

    // 保存套餐关键字变更
    function saveComboKeywordsChanges() {
        categoryCode = $('#categorySelect').combobox("getValue");
        // 获取新增的关键字
        var newKeywords = $('#newKeywords').tagbox('getValues');
        // 获取待删除的关键字
        var deletedKeywords = $('#deletedKeywords').tagbox('getValues');
        // 如果没有变更，直接关闭弹窗
        if (newKeywords.length === 0 && deletedKeywords.length === 0) {
            $.messager.alert('提示', '没有内容变更', 'info');
            return;
        }
        var pattern = /^[\u4e00-\u9fa5a-zA-Z0-9+]+$/;
        for (const keyword of newKeywords) {
            // 校验输入内容：只允许中文、英文、数字和加号
            if (!pattern.test(keyword)) {
                $.messager.alert('提示', '只能输入中文、英文、数字以及+号', 'warning');
                return;
            }
        }

        // 调用接口保存变更
        $.ajax({
            url: config.url + "/combo/keywords/edit",
            type: "POST",
            data: JSON.stringify({
                saveWords: newKeywords,
                deleteWords: deletedKeywords,
                categoryCode: categoryCode
            }),
            contentType: "application/json",
            success: function(result) {
                if (result.code != 200) {
                    $.messager.alert("提示", result.msg, "error");
                    return;
                }
                $.messager.alert('提示', '操作成功', 'info');
                closeComboKeywordsDialog();
            },
            error: function() {
                $.messager.alert('提示', '保存失败', 'error');
            }
        });
    }

    // 关闭套餐关键字设置弹窗
    function closeComboKeywordsDialog() {
        $('#comboKeywordsDialog').dialog('close');
    }

    // 恢复关键字（将关键字从待删除区域移回现有关键字区域）
    function restoreKeyword(tag) {
        // 从待删除关键字中移除
        var deletedKeywords = $('#deletedKeywords').tagbox('getValues');
        var index = deletedKeywords.indexOf(tag);
        if (index > -1) {
            deletedKeywords.splice(index, 1);
            $('#deletedKeywords').tagbox('setValues', deletedKeywords);

            // 添加回到现有关键字中
            var existingKeywords = $('#existingKeywords').tagbox('getValues');
            if (existingKeywords.indexOf(tag) === -1) {
                existingKeywords.push(tag);
                $('#existingKeywords').tagbox('setValues', existingKeywords);
            }
        }
    }
</script>
</html>